<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <ul>
        <li>黄药师</li>
        <li>欧阳锋</li>
        <li>段智兴</li>
        <li>洪七公</li>
    </ul>
</body>
<script>
    //of方法创建对象
    let arr = Array.of(10, "独角兽", "dds", 10);
    console.log(arr);


    //from方法把伪数组转换成真数组
    let obj = {
        0: 10,
        1: "nan",
        2: "fdff",
        length: 3
    }
    console.log(obj);
    let lis = document.getElementsByTagName("li");
    console.log(lis);
    console.log(Array.from(obj));
    //instanceof方法辨别该数组是不是真数组
    console.log(obj instanceof Array)//false
    console.log(lis instanceof Array)//false
    let obj1 = Array.from(obj);
    let lis1 = Array.from(lis);
    console.log(obj1 instanceof Array)//true
    console.log(lis1 instanceof Array)//true
    //find方法 
    let arr1 = [1, 4, 6, 9, 7, 3, 8];
    let arr2 = arr1.find(function (item, idx, arr1) {
        return item > 4
    });//6
    let arr3 = arr1.find(function (item, idx, arr1) {
        return idx > 4
    });//3
    console.log(arr2);
    console.log(arr3);
    //findIndex方法
    let arr4 = [4, 7, 3, 7, 8, 3, 8]
    let arr5 = arr4.findIndex(function (item, idx, arr4) {
        return item > 7
    });
    console.log(arr5);


    let wml = {
        name: "王美丽",
        age: 18,
        gender: "woman"
    }
    let arr6 = [
        {
            name: "张三",
            age: 18,
            gender: "man"
        },
        {
            name: "李四",
            age: 18,
            gender: "man"
        },
        {
            name: "王五",
            age: 18,
            gender: "man"
        },
        wml,
    ]
  let arr7=arr6.findIndex(function(item,idx,arr6){
      return item.gender=="woman"
  });
  console.log(arr7)
  console.log(arr6[arr7]);


  //includes
  console.log(arr6.includes({}));
  console.log(arr6.includes(wml));//不能写数组

</script>

</html>